package com.TestDemo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;

public class test05 {
    public static void main(String[] args) {

        test05 t5 = new test05("t1",10);
        test05 t6 = new test05("t2",300);
        test05 t7 = new test05("t3",200);

        System.out.println(t5.age);


        HashMap<Object, test05> hashMap1 = new HashMap<>();
        hashMap1.put("no1",t5);


        test05[] tarr = new test05[hashMap1.size()];

        tarr[0] = hashMap1.put("no1",t5);

        System.out.println(tarr[0].getAge());


        ArrayList<test05> objects = new ArrayList();
        ArrayList<test05> objects1= new ArrayList();
        objects.add(tarr[0]);
        objects1.add(t6);
        objects.add(objects1.get(0));

        for(int i = 0;i<objects.size();i++){
            System.out.println("age:" + objects.get(i).getAge());
        }


        System.out.println(objects);

//        System.out.println(list);
        hashMap1.get("no1");
        System.out.println(hashMap1.get("no1").toString());

        System.out.println(hashMap1.get("no1"));


        HashMap<Object, Object> hashMap = new HashMap<>();
        hashMap.put("wo0",15);
        hashMap.put("wo1",25);
        hashMap.put("wo2",35);

        System.out.println(hashMap.get("wo0"));

    }

    private String name;
    private int age;
    public test05() {
    }

    public test05(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "test05{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
